package huaweiod.first;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * 华为机试真题 Java 实现【日志首次上报最多积分】【2022.11 Q4 新题】
 */
public class A_2023_16_LogMaxPoints {

    public static int logMaxPoints(List<Integer> logs) {
        int n = logs.size();
        int[] add = new int[n];
        add[0] = logs.get(0);
        int[] sub = new int[n];
        sub[0] = 0;
        int[] res = new int[n];
        res[0] = add[0] + sub[0];
        int ans = res[0];
        for (int i = 1; i < logs.size(); i++) {
            add[i] = Math.min(100, add[i - 1] + logs.get(i));
            sub[i] = sub[i - 1] + add[i - 1];
            res[i] = add[i] - sub[i];
            ans = Math.max(ans, res[i]);
            if (add[i] >= 100) {
                break;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        //处理输入
        Scanner in = new Scanner(System.in);
        List<Integer> logs = Arrays.stream(in.nextLine().split(" "))
                .map(Integer::parseInt)
                .collect(Collectors.toList());

        // process
        System.out.println(logMaxPoints(logs));
    }
}
